let t = require;
let e = module;
let o = e.exports;
o.default = e.exports;

('use strict');
console.log('start');
var _n176,
  i =
    (this && this.__extends) ||
    ((_n176 = function n(t, e) {
      return (_n176 =
        Object.setPrototypeOf ||
        ({
          __proto__: []
        } instanceof Array &&
          function (t, e) {
            t.__proto__ = e;
          }) ||
        function (t, e) {
          for (var o in e) {
            Object.prototype.hasOwnProperty.call(e, o) && (t[o] = e[o]);
          }
        })(t, e);
    }),
    function (t, e) {
      function o() {
        this.constructor = t;
      }
      _n176(t, e),
        (t.prototype =
          null === e
            ? Object.create(e)
            : ((o.prototype = e.prototype), new o()));
    });
Object.defineProperty(o, '__esModule', {
  value: !0
}),
  (o.UIComponent = void 0);
var r = t('AbsObject'),
  a = t('GlobalEventMrg'),
  s = t('TimeMrg'),
  c = t('ComUtils'),
  l = t('UIViewRes'),
  u = t('ResMrg'),
  h = (function (t) {
    function e(e) {
      var o = t.call(this) || this;
      if (
        ((o._isInited = !1),
        (o._isShow = !1),
        (o._coms = []),
        (o._enabled = !0),
        e instanceof l.UIComRes)
      ) {
        var n = o;
        (o._view = new cc.Node()),
          u.ResMrg.loadView(e.viewName, e.packName, function (t) {
            t && n.initView(t);
          });
      } else o.initView(e);
      return o;
    }
    return (
      i(e, t),
      (e.prototype.initView = function (t) {
        this._view &&
          ((t.parent = this._view.parent), this._view.removeFromParent(!0)),
          (this._view = t),
          (this._enabled = !0),
          this.addListenerTouch(),
          this.init();
      }),
      (e.prototype.addListenerTouch = function () {
        this.view.on(
          cc.Node.EventType.TOUCH_START,
          this.onTouchEvenHandler,
          this
        ),
          this.view.on(
            cc.Node.EventType.TOUCH_MOVE,
            this.onTouchEvenHandler,
            this
          ),
          this.view.on(
            cc.Node.EventType.TOUCH_END,
            this.onTouchEvenHandler,
            this
          ),
          this.view.on(
            cc.Node.EventType.TOUCH_CANCEL,
            this.onTouchEvenHandler,
            this
          );
      }),
      (e.prototype.removeListenerTouch = function () {
        this.view.off(
          cc.Node.EventType.TOUCH_START,
          this.onTouchEvenHandler,
          this
        ),
          this.view.off(
            cc.Node.EventType.TOUCH_MOVE,
            this.onTouchEvenHandler,
            this
          ),
          this.view.off(
            cc.Node.EventType.TOUCH_END,
            this.onTouchEvenHandler,
            this
          ),
          this.view.off(
            cc.Node.EventType.TOUCH_CANCEL,
            this.onTouchEvenHandler,
            this
          );
      }),
      (e.prototype.onTouchEvenHandler = function (t) {
        this.emit(t.type, this, t);
      }),
      Object.defineProperty(e.prototype, 'enabled', {
        get: function get() {
          return this._enabled;
        },
        set: function set(t) {
          this._enabled != t && ((this._enabled = t), this.onEnabled(t));
        },
        enumerable: !1,
        configurable: !0
      }),
      (e.prototype.onEnabled = function () {}),
      (e.prototype.setGray = function (t, e) {
        void 0 === e && (e = !0), c.default.setGray(this.view, t, e);
      }),
      (e.prototype.init = function () {
        this._isInited ||
          (this.onInit(),
          this.onLang(),
          (this._isInited = !0),
          a.default.on(a.GlobalEvent.LangChanged, this.onLang, this));
      }),
      (e.prototype.onLang = function () {}),
      Object.defineProperty(e.prototype, 'parent', {
        get: function get() {
          return this._parent;
        },
        set: function set(t) {
          this._parent = t;
        },
        enumerable: !1,
        configurable: !0
      }),
      Object.defineProperty(e.prototype, 'active', {
        get: function get() {
          return this._view.active;
        },
        set: function set(t) {
          (this._view.active = t), this.onActive(t);
        },
        enumerable: !1,
        configurable: !0
      }),
      (e.prototype.onActive = function () {}),
      (e.prototype.onInit = function () {}),
      Object.defineProperty(e.prototype, 'isInited', {
        get: function get() {
          return this._isInited;
        },
        enumerable: !1,
        configurable: !0
      }),
      Object.defineProperty(e.prototype, 'isShow', {
        get: function get() {
          return this._isShow;
        },
        enumerable: !1,
        configurable: !0
      }),
      (e.prototype.addCom = function (t) {
        t &&
          (this._coms.push(t),
          (t.parent = this),
          null == t.view.parent && this.view.addChild(t.view),
          this._isShow && t.show());
      }),
      Object.defineProperty(e.prototype, 'coms', {
        get: function get() {
          return this._coms;
        },
        enumerable: !1,
        configurable: !0
      }),
      (e.prototype.removeByParent = function () {
        this._parent && (this._parent.removeCom(this), (this._parent = null));
      }),
      (e.prototype.removeCom = function (t) {
        if (t) {
          for (var e = 0; e < this._coms.length; e++) {
            if (this._coms[e].objId == t.objId) {
              this._coms.splice(e, 1);
              break;
            }
          }
          t.destroy();
        }
      }),
      (e.prototype.removeComs = function () {
        for (var t = 0; t < this._coms.length; t++) {
          this._coms[t].destroy();
        }
        this._coms = [];
      }),
      (e.prototype.update = function (t) {
        if (this._isInited) {
          this.onUpdate(t);
          for (var e = 0; e < this._coms.length; e++) {
            this._coms[e].update(t);
          }
        }
      }),
      (e.prototype.onUpdate = function () {}),
      (e.prototype.show = function () {
        if (!this._isShow) {
          this._isInited || this.init(), this.onShow();
          for (var t = 0; t < this._coms.length; t++) {
            this._coms[t].show();
          }
          this._isShow = !0;
        }
      }),
      (e.prototype.onShow = function () {}),
      (e.prototype.close = function () {
        if (this._isShow) {
          this.onClose();
          for (var t = 0; t < this._coms.length; t++) {
            this._coms[t].close();
          }
          this._isShow = !1;
        }
      }),
      (e.prototype.onClose = function () {}),
      Object.defineProperty(e.prototype, 'view', {
        get: function get() {
          return this._view;
        },
        enumerable: !1,
        configurable: !0
      }),
      (e.prototype.delayCall = function (t, e) {
        null != e && s.TimeMrg.timer.delayCall(e, this, t);
      }),
      (e.prototype.onDestroy = function () {
        t.prototype.onDestroy.call(this),
          this.removeListenerTouch(),
          s.TimeMrg.timer.removeTarget(this),
          a.default.targetOff(this);
        for (var e = 0; e < this._coms.length; e++) {
          this._coms[e].destroy();
        }
        (this._parent = null),
          this._view.removeFromParent(),
          (this._view = null);
      }),
      e
    );
  })(r.AbsObject);
(o.UIComponent = h), console.log('end');
module.exports = e.exports;
